package com.crm.controller;

import com.crm.entity.Business;
import com.crm.page.CluePage;
import com.crm.service.BusinessService;
import com.github.pagehelper.PageInfo;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/business")
@Slf4j
@AllArgsConstructor
public class BusinessController {
    private final BusinessService businessService;

    /**
     * 新增商机
     * @param business
     */
    @PostMapping
    public void insert(@RequestBody Business business){
        log.info("新增商机{}",business);
        businessService.insert(business);
    }

    /**
     *商机分页查询
     * @param BusinessPage
     * @return
     */
    @GetMapping("/list")
    public PageInfo<Business> PageBusinessList(@RequestBody CluePage BusinessPage){
        return businessService.PageBusinessList(BusinessPage);
    }

}
